package com.ofps.web.controller.flow;

import com.alibaba.fastjson.JSONObject;
import com.ofps.common.core.domain.AjaxResult;
import com.ofps.common.exception.ServiceException;
import com.ofps.flow.service.IEnterFlowInfoInstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/flowModel")
public class FlowModelController {

    @Autowired
    private IEnterFlowInfoInstService iEnterFlowInfoInstService;


    /**
     * 获取流程模型接口
     * @param jsonObject 请求参数
     * @return 流程模型数据
     */
    @PostMapping("/getFlowInfoWithNode")
    public AjaxResult getFlowInfoWithNode(@RequestBody JSONObject jsonObject) {
        if (jsonObject.getString("flowId") == null) {
            throw new ServiceException("请求参数确实, 请检查");
        }
        return AjaxResult.success(iEnterFlowInfoInstService.getFlowInfoWithNode(jsonObject));
    }
}
